﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Services;
using System.Data;

namespace QuanLyHoSoBenhNhan
{
    /// <summary>
    /// Summary description for ServiceQLHSBN
    /// </summary>
    [WebService(Namespace = "http://tempuri.org/")]
    [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
    [System.ComponentModel.ToolboxItem(false)]
    // To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line. 
    // [System.Web.Script.Services.ScriptService]
    public class ServiceQLHSBN : System.Web.Services.WebService
    {

        [WebMethod]
        public string HelloWorld()
        {
            return "Hello World";
        }
        //[WebMethod]
        //public DataTable TimKiemBenhNhan(string tenbenhnhan)
        //{
        //    DataTable table = null;
        //    string query = "";

        //    query = "select * from BENH_NHAN where HO_TEN like N'%"+ tenbenhnhan + "%' ";
        //    table = CProvider.Query(query).Tables[0];
        //    return table;
        //}
        [WebMethod]
        public DataTable TimKiemBenhNhan(string tenbenhnhan, string diachi)
        {
            DataTable table = null;
            string query = "";

            query = "select * from BENH_NHAN where HO_TEN like N'%" + tenbenhnhan + "%' and DIA_CHI like N'%" + diachi +"%'";
            table = CProvider.Query(query).Tables[0];
            return table;
        }

    }
}
